package com.kayt.cyberBar.cuser.business.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kayt.cyberBar.common.PageData;
import com.kayt.cyberBar.common.ServerResponse;
import com.kayt.cyberBar.cuser.business.entity.po.BExamRule;
import com.kayt.cyberBar.cuser.business.entity.req.vo.ExamRuleReqVO;
import com.kayt.cyberBar.cuser.business.entity.rsp.vo.ExamRuleOperateRspVO;
import com.kayt.cyberBar.cuser.business.entity.rsp.vo.ExamRuleRspVO;
import com.kayt.cyberBar.cuser.business.server.IPublicExamRuleServer;
import com.kayt.cyberBar.cuser.business.service.ExamRuleService;

@Service("publicExamRuleService")
public class ExamRuleServiceImpl implements ExamRuleService{
	@Autowired
	private IPublicExamRuleServer publicExamRuleServer;
	@Override
	public ServerResponse<PageData<ExamRuleRspVO>> getExamRuleList(ExamRuleReqVO examRuleReqVO) {
		PageData<BExamRule> examRulePageData = publicExamRuleServer.get_examRule_list(examRuleReqVO);
		return publicExamRuleServer.assemble_result_list(examRulePageData);
	}

	@Override
	public ServerResponse<ExamRuleRspVO> addExamRule(ExamRuleReqVO examRuleReqVO) {
		BExamRule examRule = publicExamRuleServer.add_examRule(examRuleReqVO);
		return publicExamRuleServer.assemble_result(examRule);
	}

	@Override
	public ServerResponse<ExamRuleRspVO> updateExamRule(ExamRuleReqVO examRuleReqVO) {
		BExamRule examRule = publicExamRuleServer.mod_examRule(examRuleReqVO);
		return publicExamRuleServer.assemble_result(examRule);
	}

	@Override
	public ServerResponse<String> deleteExamRule(String examRuleId) {
		Integer result = publicExamRuleServer.del_examRule(examRuleId);
		return publicExamRuleServer.assemble_result_string(result);
	}

	@Override
	public ServerResponse<ExamRuleOperateRspVO> getExamRuleOperateData() {
		ExamRuleOperateRspVO examRuleOperateRspVO = publicExamRuleServer.getExamRuleOperateData();
		return publicExamRuleServer.assemble_result(examRuleOperateRspVO);
	}
}
